<html>
<head>
<title>五行生克-原创易算游戏-《玄学》</title>
<meta charset="UTF-8" />
<meta name="keywords" content="meta 五行 阴阳 金木水火土">
<meta name="description" content="meta 一款五行相生相克的益智游戏">
<meta name="author" content="meta 玄月冰灵(张抿轩)ksharp8@qq.com">
</head>
<body>
    <div id="div1" style="text-align: center;font-size: 188px;">
    </div>
    <div style="text-align: center;font-size: 130px;margin:5% auto">
        <div><span><button style="font-size: 130px" onclick='than()' type="button">生</button></span>
        <span><button style="font-size: 130px" onclick='than()' type="button">克</button></span></div>
        <div style="margin:5% auto"><span><button onclick='than()' style="font-size: 130px" type="button">逆生</button></span>
        <span><button style="font-size: 130px" onclick='than()' type="button">逆克</button></span></div>
        <div><span><button style="font-size: 130px" onclick='than()' type="button">同</button></span></div>
    </div>
    <div id="div2" style="text-align: center;font-size: 188px;">
    </div>
    <div id="div3" style="text-align: center;font-size: 170px;color:red">
    </div>
    <div style="position:absolute;bottom:5%;left:5%"><button onclick="javascript:location.reload();" style="font-size:130px">重置</button></div>
    <script>
        var arr = ['金','木','水','火','土'];
        var seed1 = arr[Math.round(Math.random()*10)%5];
        var seed2 = arr[Math.round(Math.random()*10)%5];
        //seed1 = '金';
        //seed2 = '木';
        //console.log(seed1);
        var div1 = document.getElementById('div1');
        var div2 = document.getElementById('div2');

        txt1 = document.createTextNode(seed1);
        txt2 = document.createTextNode(seed2);

        div1.removeChild(div1.childNodes[0]);
        div2.removeChild(div2.childNodes[0]);

        div1.appendChild(txt1);
        div2.appendChild(txt2);

        function than(){
            if(seed1 == '金' && seed2 == '金'){
                var div3 = document.getElementById('div3');
                txt3 = document.createTextNode('金同金');
                div3.removeChild(div3.childNodes[0]);
                div3.appendChild(txt3);
            }else if(seed1 == '金' && seed2 == '木'){
                var div3 = document.getElementById('div3');
                txt3 = document.createTextNode('金克木');
                div3.removeChild(div3.childNodes[0]);
                div3.appendChild(txt3);
            }else if(seed1 == '金' && seed2 == '水'){
                var div3 = document.getElementById('div3');
                txt3 = document.createTextNode('金生水');
                div3.removeChild(div3.childNodes[0]);
                div3.appendChild(txt3);
            }else if(seed1 == '金' && seed2 == '火'){
                var div3 = document.getElementById('div3');
                txt3 = document.createTextNode('金逆克火');
                div3.removeChild(div3.childNodes[0]);
                div3.appendChild(txt3);
            }else if(seed1 == '金' && seed2 == '土'){
                var div3 = document.getElementById('div3');
                txt3 = document.createTextNode('金逆生土');
                div3.removeChild(div3.childNodes[0]);
                div3.appendChild(txt3);
            }else if(seed1 == '木' && seed2 == '金'){
                var div3 = document.getElementById('div3');
                txt3 = document.createTextNode('木逆克金');
                div3.removeChild(div3.childNodes[0]);
                div3.appendChild(txt3);
            }else if(seed1 == '木' && seed2 == '木'){
                var div3 = document.getElementById('div3');
                txt3 = document.createTextNode('木同木');
                div3.removeChild(div3.childNodes[0]);
                div3.appendChild(txt3);
            }else if(seed1 == '木' && seed2 == '水'){
                var div3 = document.getElementById('div3');
                txt3 = document.createTextNode('木逆生水');
                div3.removeChild(div3.childNodes[0]);
                div3.appendChild(txt3);
            }else if(seed1 == '木' && seed2 == '火'){
                var div3 = document.getElementById('div3');
                txt3 = document.createTextNode('木逆生火');
                div3.removeChild(div3.childNodes[0]);
                div3.appendChild(txt3);
            }else if(seed1 == '木' && seed2 == '土'){
                var div3 = document.getElementById('div3');
                txt3 = document.createTextNode('木克土');
                div3.removeChild(div3.childNodes[0]);
                div3.appendChild(txt3);
            }else if(seed1 == '水' && seed2 == '金'){
                var div3 = document.getElementById('div3');
                txt3 = document.createTextNode('水逆生金');
                div3.removeChild(div3.childNodes[0]);
                div3.appendChild(txt3);
            }else if(seed1 == '水' && seed2 == '木'){
                var div3 = document.getElementById('div3');
                txt3 = document.createTextNode('水生木');
                div3.removeChild(div3.childNodes[0]);
                div3.appendChild(txt3);
            }else if(seed1 == '水' && seed2 == '水'){
                var div3 = document.getElementById('div3');
                txt3 = document.createTextNode('水同水');
                div3.removeChild(div3.childNodes[0]);
                div3.appendChild(txt3);
            }else if(seed1 == '水' && seed2 == '火'){
                var div3 = document.getElementById('div3');
                txt3 = document.createTextNode('水克火');
                div3.removeChild(div3.childNodes[0]);
                div3.appendChild(txt3);
            }else if(seed1 == '水' && seed2 == '土'){
                var div3 = document.getElementById('div3');
                txt3 = document.createTextNode('水逆克土');
                div3.removeChild(div3.childNodes[0]);
                div3.appendChild(txt3);
            }else if(seed1 == '火' && seed2 == '金'){
                var div3 = document.getElementById('div3');
                txt3 = document.createTextNode('火克金');
                div3.removeChild(div3.childNodes[0]);
                div3.appendChild(txt3);
            }else if(seed1 == '火' && seed2 == '木'){
                var div3 = document.getElementById('div3');
                txt3 = document.createTextNode('火逆生木');
                div3.removeChild(div3.childNodes[0]);
                div3.appendChild(txt3);
            }else if(seed1 == '火' && seed2 == '水'){
                var div3 = document.getElementById('div3');
                txt3 = document.createTextNode('火逆克水');
                div3.removeChild(div3.childNodes[0]);
                div3.appendChild(txt3);
            }else if(seed1 == '火' && seed2 == '火'){
                var div3 = document.getElementById('div3');
                txt3 = document.createTextNode('火同火');
                div3.removeChild(div3.childNodes[0]);
                div3.appendChild(txt3);
            }else if(seed1 == '火' && seed2 == '土'){
                var div3 = document.getElementById('div3');
                txt3 = document.createTextNode('火生土');
                div3.removeChild(div3.childNodes[0]);
                div3.appendChild(txt3);
            }else if(seed1 == '土' && seed2 == '土生金'){
                var div3 = document.getElementById('div3');
                txt3 = document.createTextNode('金克木');
                div3.removeChild(div3.childNodes[0]);
                div3.appendChild(txt3);
            }else if(seed1 == '土' && seed2 == '木'){
                var div3 = document.getElementById('div3');
                txt3 = document.createTextNode('土逆克木');
                div3.removeChild(div3.childNodes[0]);
                div3.appendChild(txt3);
            }else if(seed1 == '土' && seed2 == '水'){
                var div3 = document.getElementById('div3');
                txt3 = document.createTextNode('土生水');
                div3.removeChild(div3.childNodes[0]);
                div3.appendChild(txt3);
            }else if(seed1 == '土' && seed2 == '火'){
                var div3 = document.getElementById('div3');
                txt3 = document.createTextNode('土逆生火');
                div3.removeChild(div3.childNodes[0]);
                div3.appendChild(txt3);
            }else if(seed1 == '土' && seed2 == '土'){
                var div3 = document.getElementById('div3');
                txt3 = document.createTextNode('土同土');
                div3.removeChild(div3.childNodes[0]);
                div3.appendChild(txt3);
            }
        }
    </script>
</body>
</html>